<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Connecting to a new site</title>
    <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="start" href="index.html" title="Berkeley DB Programmer's Reference Guide" />
    <link rel="up" href="rep.html" title="Chapter 12.  Berkeley DB Replication" />
    <link rel="prev" href="rep_comm.html" title="Building the communications infrastructure" />
    <link rel="next" href="group_membership.html" title="Managing Replication Manager Group Membership" />
  </head>
  <body>
    <div xmlns="" class="navheader">
      <div class="libver">
        <p>Library Version 11.2.5.3</p>
      </div>
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">Connecting to a new site</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="rep_comm.html">Prev</a> </td>
          <th width="60%" align="center">Chapter 12. 
		Berkeley DB Replication
        </th>
          <td width="20%" align="right"> <a accesskey="n" href="group_membership.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="sect1" lang="en" xml:lang="en">
      <div class="titlepage">
        <div>
          <div>
            <h2 class="title" style="clear: both"><a id="rep_newsite"></a>Connecting to a new site</h2>
          </div>
        </div>
      </div>
      <p>To add a new site to the replication group all that is needed
is for the client member to join.  Berkeley DB will perform an
internal initialization from the master to the client automatically
and will run recovery on the client to bring it up to date
with the master.</p>
      <p>For Base API applications, connecting to a
new site in the replication group happens whenever the
<a href="../api_reference/C/repmessage.html" class="olink">DB_ENV-&gt;rep_process_message()</a> method returns <a href="../api_reference/C/repmessage.html#repmsg_DB_REP_NEWSITE" class="olink">DB_REP_NEWSITE</a>.  The application
should assign the new site a local environment ID number, and all future
messages from the site passed to <a href="../api_reference/C/repmessage.html" class="olink">DB_ENV-&gt;rep_process_message()</a> should include that
environment ID number.  It is possible, of course, for the application
to be aware of a new site before the return of <a href="../api_reference/C/repmessage.html" class="olink">DB_ENV-&gt;rep_process_message()</a> (for
example, applications using connection-oriented protocols are likely to
detect new sites immediately, while applications using broadcast
protocols may not).</p>
      <p>Regardless, in applications supporting the dynamic addition of database
environments to replication groups, environments joining an existing
replication group may need to provide contact information.  (For
example, in an application using TCP/IP sockets, a DNS name or IP
address might be a reasonable value to provide.)  This can be done using
the <span class="bold"><strong>cdata</strong></span> parameter to the <a href="../api_reference/C/repstart.html" class="olink">DB_ENV-&gt;rep_start()</a> method.  The information
referenced by <span class="bold"><strong>cdata</strong></span> is wrapped in the initial contact message
sent by the new environment, and is provided to the existing members of
the group using the <span class="bold"><strong>rec</strong></span> parameter returned by <a href="../api_reference/C/repmessage.html" class="olink">DB_ENV-&gt;rep_process_message()</a>.
If no additional information was provided for Berkeley DB to forward to the
existing members of the group, the <span class="bold"><strong>data</strong></span> field of the <span class="bold"><strong>rec</strong></span>
parameter passed to the <a href="../api_reference/C/repmessage.html" class="olink">DB_ENV-&gt;rep_process_message()</a> method will be NULL after
<a href="../api_reference/C/repmessage.html" class="olink">DB_ENV-&gt;rep_process_message()</a> returns <a href="../api_reference/C/repmessage.html#repmsg_DB_REP_NEWSITE" class="olink">DB_REP_NEWSITE</a>.</p>
      <p>Replication Manager automatically distributes contact information
using the mechanisms previously described.</p>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="rep_comm.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="rep.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="group_membership.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">Building the communications infrastructure </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> Managing Replication Manager Group Membership</td>
        </tr>
      </table>
    </div>
  </body>
</html>
